package org.nobject.common.swing;

import java.awt.Container;

import javax.swing.JDesktopPane;
import javax.swing.JInternalFrame;
import javax.swing.event.InternalFrameEvent;
import javax.swing.event.InternalFrameListener;

import org.nobject.common.log.Log;

/**
 * CreateInternalFrameListener
 *
 * @author Benson
 *
 */
public class CreateInternalFrameListener implements InternalFrameListener {
	
	/**
	 * container
	 */
	private Container container;
	
	/**
	 * 构造函数
	 * @param container
	 */
	public CreateInternalFrameListener(Container container){
		this.container=container;
	}
	
	/* (non-Javadoc)
	 * @see javax.swing.event.InternalFrameListener#internalFrameActivated(javax.swing.event.InternalFrameEvent)
	 */
	public void internalFrameActivated(InternalFrameEvent e) {

	}

	/* (non-Javadoc)
	 * @see javax.swing.event.InternalFrameListener#internalFrameClosed(javax.swing.event.InternalFrameEvent)
	 */
	public void internalFrameClosed(InternalFrameEvent e) {
		JInternalFrame iframe=e.getInternalFrame();
		container.remove(iframe);
		if(JDesktopPane.class.isAssignableFrom(container.getClass())){
			((JDesktopPane)container).updateUI();
			System.out.println("OS");
		}else{
			Log.error("类"+container.getClass()+"没有进行updateUI操作");;
		}
	}

	public void internalFrameClosing(InternalFrameEvent e) {

	}

	public void internalFrameDeactivated(InternalFrameEvent e) {

	}

	public void internalFrameDeiconified(InternalFrameEvent e) {

	}

	public void internalFrameIconified(InternalFrameEvent e) {

	}

	public void internalFrameOpened(InternalFrameEvent e) {
		
	}

}
